/*
 * Label.cpp
 *
 *  Created on: 06-12-2010
 *      Author: Przemek
 */

#include "gui/GLFont.hpp"
#include "gui/UIManager.hpp"
#include "gui/Label.hpp"
#include "gui/ClipArea.hpp"
using namespace std;

Label::Label(const string& text, const GLColor& color) :
	text(text), color(color)
{

}

void Label::setText(const std::string& text)
{
	this->text = text;
}

string Label::getText() const
{
	return text;
}

void Label::draw(const ClipArea& clipArea)
{
	clipArea.setGLClipArea();
	color.setGLState();
	const GLFont& font = UIManager::getInstance().getGUIFont();
	font.begin();
	font.drawTextAt(text, getCenteredTextLeftCornerPosition(text));
	font.end();
}

